package com.luom.springbootinit.service;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.github.pagehelper.PageInfo;
import com.luom.springbootinit.model.dto.borrowRecord.BorrowRecordAddRequest;
import com.luom.springbootinit.model.dto.borrowRecord.BorrowRecordQueryRequest;
import com.luom.springbootinit.model.dto.borrowRecord.BorrowRecordUpdateRequest;
import com.luom.springbootinit.model.entity.BorrowRecord;
import com.luom.springbootinit.model.vo.BorrowRecordVO;

import javax.servlet.http.HttpServletRequest;
import java.util.List;

/**
 * 借阅信息服务
 *
 */
public interface BorrowRecordService extends IService<BorrowRecord> {

    /**
     * 校验数据
     *
     * @param borrowRecord
     * @param add 对创建的数据进行校验
     */
    void validBorrowRecord(BorrowRecord borrowRecord, boolean add);

    /**
     * 获取查询条件
     *
     * @param borrowRecordQueryRequest
     * @return
     */
    @Deprecated
    QueryWrapper<BorrowRecord> getQueryWrapper(BorrowRecordQueryRequest borrowRecordQueryRequest);
    
    /**
     * 获取借阅信息封装
     *
     * @param borrowRecord
     * @param request
     * @return
     */
    BorrowRecordVO getBorrowRecordVO(BorrowRecord borrowRecord, HttpServletRequest request);

    /**
     * 分页获取借阅信息封装
     *
     * @param borrowRecordPage
     * @param request
     * @return
     */
    Page<BorrowRecordVO> getBorrowRecordVOPage(Page<BorrowRecord> borrowRecordPage, HttpServletRequest request);

    /**
     * 更新借阅信息
     * @param borrowRecordUpdateRequest
     * @return
     */
    boolean updateRecord(BorrowRecordUpdateRequest borrowRecordUpdateRequest);

    /**
     * 填充查询数据
     * @param borrowRecordQueryRequest
     * @return
     */
    @Deprecated
    BorrowRecordQueryRequest addQueryParams(BorrowRecordQueryRequest borrowRecordQueryRequest);

    /**
     * 获取分页数据
     * @param isMyRecord 是否是查询当前用户的借阅记录
     * @param borrowRecordQueryRequest 查询条件
     * @param request 获取session 信息
     * @return
     */
    PageInfo<BorrowRecordVO> getBorrowRecordVOPage(boolean isMyRecord , BorrowRecordQueryRequest borrowRecordQueryRequest, HttpServletRequest request);


    /**
     * 批量更新借阅状态
     * @param ids
     * @return
     */
    int updateBatchStatus(List<Integer> ids);


    /**
     * 新增借阅记录
     * @param borrowRecordAddRequest
     * @param request
     * @return
     */
    long addBorrowRecord(BorrowRecordAddRequest borrowRecordAddRequest, HttpServletRequest request);
}
